/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bpmlab.kivulifx;

import bpmlab.kivulifx.application.Context;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

/**
 *
 * @author bpmlab
 */
public class Main extends Application {

    public static Stage stage;
    
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        stage = primaryStage;
        Parent root = FXMLLoader.load(getClass().getResource("/fxml/Index.fxml"));
        Scene scene = new Scene(root);
        stage.setFullScreen(true);
        primaryStage.setScene(scene);
        primaryStage.setTitle("KivuliFX");
        Context.getCurrentInstance().initContext();
        primaryStage.setOnCloseRequest((WindowEvent event) -> {
            Context.getCurrentInstance().destroyContext();
        });
        primaryStage.show();
    }
}
